home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Games Collection 1
/
software vault.zip
/
software vault
/
CDR10
/
MS_ARCAD.ZIP
/
ARCINTRO.CHP
< prev
next >
Wrap
Text File
|
1993-06-15
|
6KB
|
176 lines
%
#EF
#TProgramming Object Oriented Arcade Games In Turbo C
#HS,1,1,80,25,11,1
#AL,1,13,1
~W~IIntroduction~Y~I
#W
%
#EF
#TIntroduction Pg. 1
#HS,1,1,80,25,11,1
#C4,R5
~W~IA Note From The Author~Y~I
I like computer graphics. I like it a lot. The visual satisfaction that I
get from implementing graphically-oriented systems is hard to describe to
anyone that hasn't done it. There are quite a few people around that are
just like me. That's one of the reasons that so many people write games.
#WN
If you've never written a game you may not know this, but the same
principles that are used to implement games are used in high-powered
graphics systems such as commercial flight simulators. Even something
as exotic as the symbology on a jet fighter display is controlled and
animated in the same ways that animation is done in games. Once you
become familiar with the basic concepts, you can produce a wide variety
of systems from simple games to aerospace applications.
#WP
%
#EF
#TIntroduction Pg. 2
#HS,1,1,80,25,11,1
#C4,R5
~Y~I
When I decided to write a game, I looked and looked for a book that would
give me an in-depth explanation of the principles of animation and
simulation. Much of what was available either took a Phd. in Computer
Science to be able to understand, or it was such a hodge-podge of
implementation-specific code that it wasn't any real help. And that's where
the idea for this ~W~Ibook~Y~I came from.
#WN
Although this isn't a traditional way to publish a book, this is a book
nonetheless. Unlike normal printed book, this book is ~R~Iinteractive~Y~I.
It's like having a personal tutor to teach you how to write games.
#WN
My objectives for this text are 1) to give you as the reader a clear
picture of how to animate objects on a computer screen, 2) to explain and
demonstrate how to produce libraries of highly reusable graphic objects,
and 3) to show how you might pull what you know into viable game programs.
#WP
%
#EF
#TIntroduction Pg. 3
#HS,1,1,80,25,11,1
#C4,R5
~Y~I
You will notice as you read through this book that I stress modular design
and development. I use ~W~Iinformation hiding~Y~I (I'll explain what I mean
by information hiding in Chapter 5) as much as I can without sacrificing
performance. I would encourage you to use well-structured, modular design
techniques for your games. A successful game can spawn sequels. If your
game is well designed, you will probably be able to re-use a lot of your
code. In computing, we often talk about not re-inventing the wheel, but
you'd be surprised how few times we take steps to prevent ourselves from
having to do exactly that.
#WN
You'll see in the example game that structured design and development is
something of a mania with me. I've been doing design and development for
about nine years now, both while working for companies and as a freelance
contract programmer. Nowadays I'm running my own consulting company and
teaching computer programming at the college level. All of my experience
has taught me that structured design and development is one of the most
basic ways of producing high quality code.
#WP
%
#EF
#TIntroduction Pg. 4
#HS,1,1,80,25,11,1
#C4,R5
~Y~I
Since the code in this book is for instructional purposes, I've tried to
make it as clear and straightforward as possible. In some cases I've
sacrificed a little speed to gain readability. It will run fast enough
for almost any game you want to use it in. But if you're writing a
heavy-duty application and you're familiar enough with C to be able
optimize the code, please feel free to do so.
#WN
Normally, when I write code, I document it extensively with file and
function banners, as well as liberal amounts of comments. A file banner
is a formalized banner of comments at the beginning of the file telling
what sort of functions are in that particular file. A function banner is
a comment banner that gives the name of the function, explains what the
function does (and probably also tells how it is done), documents all
information that goes in, and explains all of the information that comes
out.
#WP
%
#EF
#TIntroduction Pg. 5
#HS,1,1,80,25,11,1
#C4,R5
~Y~I
In this book, I have omitted almost all of that from the code. That's
because the one of the purposes of the book is to document the code. When
you produce games on your own, I would encourage you to document the code
as thoroughly as possible.
#WN
My hope in writing this book is that you will use the fundamentals I
explain here to build yourself a library of highly re-usable code that
will enable you to quickly put together any sort of game you want to.
After all, that's the only way to make any real money at it.
#WN
Good Luck,
#WN
|Dave Conger|
#WP
%
#EF
#TIntroduction Pg. 6
#HS,1,1,80,25,11,1
#C4,R5
~W~IWhat You Need To Use This Book
~Y~ITo get full utilization from this book and the code in it, you will need
the following:
~C~IHardware~Y~I
An MS DOS compatible computer with one of the following graphics cards (or
a card compatible with one of the following) EGA, VGA, SVGA.
#WN
~C~ISoftware~Y~I
IBM PC DOS (available from IBM) or MS DOS (available from Microsoft Corp.)
version 2.0 or later, and TURBO C (by Borland International) version 2.0 or
later. TURBO C++ version 2.0 or later can be used as well.
#WN
If you don't have TURBO C, don't despair. You can still use most of this
code with other C compilers, with minor modifications. The reason that
TURBO C was chosen for this project is that the Borland Graphics Interface
(BGI) provided with TURBO C is especially well suited to writing programs
that can support a wide variety of video adapters.
#WP
%
#EF
#TIntroduction Pg. 7
#HS,1,1,80,25,11,1
#C4,R5
~Y~I
By the way, from time to time you'll see the symbol ~W~Iāā ~Y~Iin the example
code. This is a logical or. Normally we use a pair of pipe symbols (ASCII
character #124) for logical or. However, the authoring system I used to
produce this tutorial uses that symbol for something else. Therefore, I
wasn't able to put it in the code.
Of course, all source code in this tutorial is in the .C and .H files
that come with it. In the source files a pair of character 124's is used.
So you should have no trouble compiling the accompanying source files.
#WP
#X